package pojo;

public class HttpResult {
	private int status;
	private int count;
	private int code;
	private String msg;
	private Object data;

	public static HttpResult error(String msg) {
		HttpResult r = new HttpResult();
		r.setStatus(500);
		r.setMsg(msg);
		r.setData(null);
		return r;
	}

	public static HttpResult error() {
		HttpResult r = new HttpResult();
		r.setStatus(500);
		r.setMsg(null);
		r.setData(null);
		return r;
	}

	public static HttpResult error(Object data) {
		HttpResult r = new HttpResult();
		r.setStatus(500);
		r.setMsg(null);
		r.setData(data);
		return r;
	}

	public static HttpResult ok(String msg) {
		HttpResult r = new HttpResult();
		r.setStatus(200);
		r.setMsg(msg);
		r.setData(null);
		return r;
	}

	public static HttpResult ok() {
		HttpResult r = new HttpResult();
		r.setStatus(200);
		r.setMsg(null);
		r.setData(null);
		return r;
	}

	public static HttpResult ok(Object data) {
		HttpResult r = new HttpResult();
		r.setStatus(200);
		r.setMsg(null);
		r.setData(data);
		return r;
	}
	public static HttpResult ok(int count,Object data) {
		HttpResult r = new HttpResult();
		r.setStatus(200);
		r.setCode(0);
		r.setCount(count);
		r.setMsg(null);
		r.setData(data);
		return r;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}

	public int getCount() {
		return count;
	}

	public void setCount(int count) {
		this.count = count;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

}
